package com.tangcco.lockwell.service.impl;

import com.tangcco.lockwell.domain.Groups;
import com.tangcco.lockwell.repository.BaseMapper;
import com.tangcco.lockwell.repository.GroupsMapper;
import com.tangcco.lockwell.service.GroupsService;
import com.tangcco.lockwell.viewmodel.admin.groups.GroupsMemberVM;
import com.tangcco.lockwell.viewmodel.admin.groups.GroupsPageFindVM;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Collections;
import java.util.List;
@Service
public class GroupsServiceImpl extends BaseServiceImpl<Groups> implements GroupsService {



    @Resource
    private GroupsMapper groupsMapper;

    public GroupsServiceImpl(BaseMapper<Groups> baseMapper) {
        super(baseMapper);
    }

    //删除群组
    @Override
    public int deleteById(Integer id) {
        return groupsMapper.deleteGroups(id);
    }

    @Override
    public int insert(Groups groups) {
        return groupsMapper.insertGroups(groups);
    }

    @Override
    public int updateGroupsByIdSelective(Groups groups) {
        return groupsMapper.updateGroupsByIdSelective(groups);
    }

    @Override
    public int selectCountGroups() {
        return groupsMapper.selectCountGroups();
    }

    @Override
    public int updateStatus(Integer groupId) {
        return groupsMapper.updateStatus(groupId);
    }

    @Override
    public int updateStatusOn(Integer groupId) {
        return groupsMapper.updateStatusOn(groupId);
    }

    @Override
    public Groups selectGroupById(Integer groupId) {
        return groupsMapper.selectGroupById(groupId);
    }
    @Override
    public GroupsPageFindVM selectByGroupId(Integer groupId){
        return groupsMapper.selectByGroupId(groupId);
    }

    @Override
    public List<GroupsPageFindVM> findGroupsByConditionsSelective(GroupsPageFindVM groupsPageFindVM) {
        return groupsMapper.findGroupsByConditionsSelective(groupsPageFindVM);
    }

    @Override
    public List<GroupsMemberVM> findGroupsMemberByGroupId(GroupsMemberVM groupsMemberVM) {
        return groupsMapper.findGroupsMemberByGroupId(groupsMemberVM);
    }

    @Override
    public List<GroupsPageFindVM> findGroupByUserId(Integer userId) {
        return groupsMapper.findGroupsByUserId(userId);
    }
}
